[POWERPC][XEN] Don't create a start_info_t structure for dom0.
authorHollis Blanchard <hollisb@us.ibm.com>
Thu, 1 Mar 2007 20:32:58 +0000 (14:32 -0600)
committerHollis Blanchard <hollisb@us.ibm.com>
Thu, 1 Mar 2007 20:32:58 +0000 (14:32 -0600)
It's no longer needed now that Linux constructs its own via device tree
properties.
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
--HG--
extra : transplant_source : 6%29Qsq%F0%05x%9B%1B%03%8E%FC%93%EAI%B6%D4%FAx

tools/libxc/powerpc64/xc_linux_build.c
xen/arch/powerpc/domain_build.c
xen/arch/powerpc/mm.c
xen/arch/powerpc/ofd_fixup.c
xen/arch/powerpc/oftree.h
xen/include/asm-powerpc/domain.h
xen/include/public/arch-powerpc.h

index e6b45ec4667bda99c5fb744d060ca7cfc1e4e2c7..8c58f3122212bb7de5f23798ab33a3746fbd28cd 100644 (file)
@@ -33,7 +33,6 @@
 #include <xc_private.h>
 #include <xg_private.h>
 #include <xenctrl.h>
-#include <xen/arch-powerpc.h>
 
 #include "flatdevtree_env.h"
 #include "flatdevtree.h"
@@ -256,10 +255,9 @@ int xc_linux_build(int xc_handle,
     }
 
     /* determine shared_info, console, and store paddr */
-    shared_info_paddr = (rma_pages << PAGE_SHIFT) -
-                        (RMA_SHARED_INFO * PAGE_SIZE);
-    console_paddr = (rma_pages << PAGE_SHIFT) - (RMA_CONSOLE * PAGE_SIZE);
-    store_paddr = (rma_pages << PAGE_SHIFT) - (RMA_STORE * PAGE_SIZE);
+    shared_info_paddr = (rma_pages << PAGE_SHIFT) - PAGE_SIZE;
+    console_paddr = shared_info_paddr - PAGE_SIZE;
+    store_paddr = console_paddr - PAGE_SIZE;
 
     /* map paddrs to mfns */
     *store_mfn = page_array[(xen_pfn_t)(store_paddr >> PAGE_SHIFT)];
index 68bad1227eb93586180e2bb45b1ff91020eaa0df..e9d48efe2e589fddc35ecd41f6fb574db3066b5b 100644 (file)
@@ -67,10 +67,12 @@ int construct_dom0(struct domain *d,
     uint rma_nrpages = 1 << d->arch.rma_order;
     ulong rma_sz = rma_size(d->arch.rma_order);
     ulong rma = page_to_maddr(d->arch.rma_page);
-    start_info_t *si;
     ulong eomem;
     int preempt = 0;
     int vcpu;
+    ulong mod_start = 0;
+    ulong mod_len = 0;
+    ulong shared_info_addr;
 
     /* Sanity! */
     BUG_ON(d->domain_id != 0);
@@ -134,24 +136,8 @@ int construct_dom0(struct domain *d,
 
     ASSERT( image_len < rma_sz );
 
-    si = (start_info_t *)(rma_addr(&d->arch, RMA_START_INFO) + rma);
-    printk("xen_start_info: %p\n", si);
-
-    snprintf(si->magic, sizeof(si->magic), "xen-%i.%i-powerpc%d%s",
-            xen_major_version(), xen_minor_version(), BITS_PER_LONG, "HV");
-    si->flags = SIF_PRIVILEGED | SIF_INITDOMAIN;
-
-    si->shared_info = ((ulong)d->shared_info) - rma;
-    printk("shared_info: 0x%lx,%p\n", si->shared_info, d->shared_info);
-
-    eomem = si->shared_info;
-
-    /* number of pages accessible */
-    si->nr_pages = rma_sz >> PAGE_SHIFT;
-
-    si->pt_base = 0;
-    si->nr_pt_frames = 0;
-    si->mfn_list = 0;
+    eomem = ((ulong)d->shared_info) - rma;
+    printk("shared_info: 0x%lx,%p\n", eomem, d->shared_info);
 
     /* OF usually sits here:
      *   - Linux needs it to be loaded before the vmlinux or initrd
@@ -217,14 +203,12 @@ int construct_dom0(struct domain *d,
         printk("loading initrd: 0x%lx, 0x%lx\n", dst, initrd_len);
         memcpy((void *)dst, (void *)initrd_start, initrd_len);
 
-        si->mod_start = dst - rma;
-        si->mod_len = image_len;
+        mod_start = dst - rma;
+        mod_len = image_len;
 
         dst = ALIGN_UP(dst + initrd_len, PAGE_SIZE);
     } else {
         printk("no initrd\n");
-        si->mod_start = 0;
-        si->mod_len = 0;
     }
 
     if (elf_64bit(&elf)) {
@@ -233,8 +217,8 @@ int construct_dom0(struct domain *d,
         v->arch.ctxt.msr = 0;
     }
     v->arch.ctxt.gprs[2] = 0;
-    v->arch.ctxt.gprs[3] = si->mod_start;
-    v->arch.ctxt.gprs[4] = si->mod_len;
+    v->arch.ctxt.gprs[3] = mod_start;
+    v->arch.ctxt.gprs[4] = mod_len;
 
        printk("dom0 initial register state:\n"
                        "    pc %016lx msr %016lx\n"
@@ -248,11 +232,10 @@ int construct_dom0(struct domain *d,
                        v->arch.ctxt.gprs[4],
                        v->arch.ctxt.gprs[5]);
 
-    memset(si->cmd_line, 0, sizeof(si->cmd_line));
-    if ( cmdline != NULL )
-        strlcpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line));
+    /* convert xen pointer shared_info into guest physical */
+    shared_info_addr = (ulong)d->shared_info - page_to_maddr(d->arch.rma_page);
 
-    ofd_dom0_fixup(d, *ofh_tree + rma, si);
+    ofd_dom0_fixup(d, *ofh_tree + rma, cmdline, shared_info_addr);
 
     set_bit(_VCPUF_initialised, &v->vcpu_flags);
 
index 96fddd3d5cd0a1df9fc53e2bce380ea6ae86648e..ae53469d904e7a067b8921d44bea58340b4cb546 100644 (file)
@@ -384,8 +384,8 @@ int allocate_rma(struct domain *d, unsigned int order)
         clear_page((void *)page_to_maddr(&d->arch.rma_page[i]));
     }
 
-    d->shared_info = (shared_info_t *)
-        (rma_addr(&d->arch, RMA_SHARED_INFO) + rma_base);
+    /* shared_info uses last page of RMA */
+    d->shared_info = (shared_info_t *) (rma_base + rma_sz - PAGE_SIZE);
 
     /* if there are already running vcpus, adjust v->vcpu_info */
     /* XXX untested */
index 7a1dbc34cf5f66509dd8d88bb23ab3bb2ea73f74..453ce4be17979ca0c8856602f6551ef5c4b509c0 100644 (file)
@@ -326,7 +326,7 @@ static ofdn_t ofd_rtas_props(void *m)
 }
 #endif
 
-static ofdn_t ofd_xen_props(void *m, struct domain *d, start_info_t *si)
+static ofdn_t ofd_xen_props(void *m, struct domain *d, ulong shared_info)
 {
     ofdn_t n;
     static const char path[] = "/xen";
@@ -349,19 +349,25 @@ static ofdn_t ofd_xen_props(void *m, struct domain *d, start_info_t *si)
         ASSERT(xl < sizeof (xen));
         ofd_prop_add(m, n, "version", xen, xl + 1);
 
-        val[0] = (ulong)si - page_to_maddr(d->arch.rma_page);
+        /* convert xen pointer to guest physical */
+        val[0] = shared_info;
         val[1] = PAGE_SIZE;
-        ofd_prop_add(m, n, "start-info", val, sizeof (val));
+        ofd_prop_add(m, n, "shared-info", val, sizeof (val));
 
-        val[1] =  RMA_LAST_DOM0 * PAGE_SIZE;
-        val[0] =  rma_size(d->arch.rma_order) - val[1];
+        /* reserve PAGE_SIZE @ addr shared info */
         ofd_prop_add(m, n, "reserved", val, sizeof (val));
 
+        /* flags |= SIF_PROVILEDGED; */
+        ofd_prop_add(m, n, "privileged", NULL, 0);
+
+        /* flags |= SIF_INITDOMAIN; */
+        ofd_prop_add(m, n, "initdomain", NULL, 0);
+
         /* tell dom0 that Xen depends on it to have power control */
         if (!rtas_entry)
             ofd_prop_add(m, n, "power-control", NULL, 0);
 
-        /* tell dom0 where ranted pages go in the linear map */
+        /* tell dom0 where granted pages go in the linear map */
         val[0] = cpu_foreign_map_order();
         val[1] = d->arch.foreign_mfn_count;
         ofd_prop_add(m, n, "foreign-map", val, sizeof (val));
@@ -375,7 +381,8 @@ static ofdn_t ofd_xen_props(void *m, struct domain *d, start_info_t *si)
     return n;
 }
 
-int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si)
+int ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline,
+                   ulong shared_info)
 {
     void *m;
     const ofdn_t n = OFD_ROOT;
@@ -401,13 +408,13 @@ int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si)
     ofd_cpus_props(m, d);
 
     printk("Add /chosen props\n");
-    ofd_chosen_props(m, (char *)si->cmd_line);
+    ofd_chosen_props(m, cmdline);
 
     printk("fix /memory props\n");
     ofd_memory_props(m, d);
 
     printk("fix /xen props\n");
-    ofd_xen_props(m, d, si);
+    ofd_xen_props(m, d, shared_info);
 
     printk("Remove original /dart\n");
     ofd_prune_path(m, "/dart");
index d1ad7a15989479a35ae32086156635d2101f36d9..debc4634b6d9df838f48390c59ce049cdac5694c 100644 (file)
@@ -28,7 +28,8 @@ extern ulong oftree_len;
 extern ulong oftree_end;
 extern ofdn_t ofd_boot_cpu;
 
-extern int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si);
+extern int ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline,
+                          ulong shared_info);
 extern void ofd_memory_props(void *m, struct domain *d);
 
 extern int firmware_image_start[0];
index 367c90414ccd257228d110caffe1e14a570a7c6e..b3a10f220cb49b0b6a6fd764c9cbf969fbb4bf8e 100644 (file)
@@ -109,9 +109,4 @@ extern void load_float(struct vcpu *);
 
 #define rma_size(rma_order) (1UL << ((rma_order) + PAGE_SHIFT))
 
-static inline ulong rma_addr(struct arch_domain *ad, int type)
-{
-    return rma_size(ad->rma_order) - (type * PAGE_SIZE);
-}
-
 #endif
index 3f6b9930508ae8f90e2576b445aa809453141417..82854d75d351d99122d3ce31f05ed45f3c04b2a5 100644 (file)
@@ -118,14 +118,6 @@ struct arch_shared_info {
 struct arch_vcpu_info {
 };
 
-#define RMA_SHARED_INFO 1
-#define RMA_START_INFO 2
-#define RMA_LAST_DOM0 2
-/* these are not used for dom0 so they should be last */
-#define RMA_CONSOLE 3
-#define RMA_STORE 4
-#define RMA_LAST_DOMU 4
-
 /* Support for multi-processor guests. */
 #define MAX_VIRT_CPUS 32
 #endif